<template>
  <div>
    <el-dropdown @command="handleCommand">
      <span class="el-dropdown-link"> {{ allProp.dropTitle }}<i class="el-icon-arrow-down el-icon--right"></i> </span>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item v-for="item in allProp.dropArr" :key="item.index">{{ item.label }}</el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
  </div>
</template>

<script>
import { watchEffect } from 'vue'
export default {
  props: {
    dropTitle: {
      type: String,
      default: '标题自定义'
    },
    dropData: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  setup(props) {
    let allProp = {
      dropTitle: '',
      dropArr: []
    }
    watchEffect(() => {
      allProp.dropTitle = props.dropTitle
      allProp.dropArr = props.dropData
    })
    console.log(allProp.dropArr)

    const handleCommand = () => {}
    return {
      allProp,
      handleCommand
    }
  }
}
</script>

<style></style>
